﻿<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="EditMediaFile.aspx.cs" Inherits="Cms.Web.UI.Admin.EditMediaFile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script language="javascript" type="text/javascript" src="Admin/Js/Edit.js"></script>
    <script language="javascript">
        //<![CDATA[
        function updatePanels(tab) {
            var pnlProperties = document.getElementById("ctl00_body_pnlProperties");
            var pnlDescription = document.getElementById("ctl00_body_pnlDescription");
            pnlProperties.style.display = "none";
            pnlDescription.style.display = "none";
            switch (tab) {
                case "properties":
                    pnlProperties.style.display = "";
                    break;
                case "description":
                    pnlDescription.style.display = "";
                    break;
            }
        }

        var txtFilename;
        var ddlFolders;
        var txtSortKey;
        var txtTitle;
        var txtDescription;

        var originalFilename;
        var originalFolderID;
        var originalSortKey;
        var originalCategories;
        var originalTitle;
        var originalSelectedCategories;
        var originalSelectedAllowedAdminGroups;
        var originalSelectedDeniedAdminGroups;
        var originalSelectedRequiredUserGroups;

        function init() {
            txtFilename = document.getElementById("ctl00_body_txtFilename");
            ddlFolders = document.getElementById("ctl00_body_ddlFolders");
            txtSortKey = document.getElementById("ctl00_body_txtSortKey");
            txtTitle = document.getElementById("ctl00_body_txtTitle");
            txtDescription = document.getElementById("ctl00_body_txtDescription");
            originalFilename = txtFilename.value;
            originalFolderID = ddlFolders.options[ddlFolders.selectedIndex].value;
            originalSortKey = txtSortKey.value;
            originalSelectedCategories = cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdCategories");
            originalTitle = txtTitle.value;
            originalDescription = txtDescription.value;
            originalSelectedAllowedAdminGroups = cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdAllowedAdminGroups");
            originalSelectedDeniedAdminGroups = cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdDeniedAdminGroups");
            originalSelectedRequiredUserGroups = cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdRequiredUserGroups");
        }

        function isDirty() {
            ddlFolders = document.getElementById("ctl00_body_ddlFolders");
            var value = originalFilename == "" ||
	                    originalFilename != txtFilename.value ||
	                    originalFolderID != ddlFolders.options[ddlFolders.selectedIndex].value ||
	                    originalTitle != txtTitle.value ||
	                    originalDescription != txtDescription.value ||
	                    originalSortKey != txtSortKey.value ||
	                    originalSelectedCategories != cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdCategories") ||
	                    originalSelectedAllowedAdminGroups != cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdAllowedAdminGroups") ||
	                    originalSelectedDeniedAdminGroups != cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdDeniedAdminGroups") ||
	                    originalSelectedRequiredUserGroups != cms.Edit.GetSelectedCheckboxValues("ctl00_body_tdRequiredUserGroups");
            document.getElementById("ctl00_tabs_hidIsDirty").value = value;
            return value;
        }
        //]]>
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="buttons" runat="server">
    <asp:LinkButton ID="lbSaveFile" runat="server" OnClick="lbSaveFile_Click" CssClass="orangeButton"><span><span><img src="Admin/Img/icons/disk.png" alt="" /><span><cms:LocalizedLiteral ID="llSaveFile" runat="server" /></span></span></span></asp:LinkButton>
    <asp:hyperlink ID="hlCancel" runat="server" CssClass="orangeButton"><span><span><img src="Admin/Img/icons/delete.png" alt="" /><span><cms:LocalizedLiteral ID="llCancel" runat="server" /></span></span></span></asp:hyperlink>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="tabs" runat="server">
    <asp:UpdatePanel ID="upnlTabs" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
        <ContentTemplate>
            <cms:AdminTabStrip ID="tabStrip" runat="server" SelectedValue="properties" OnChange="tabStrip_Click">
                <cms:AdminTabItem ID="tiProperties" runat="server" value="properties" EnabledImage="Admin/Img/icons/page_white_gear.png"><cms:LocalizedLiteral ID="llPropertiesTab" runat="server" /></cms:AdminTabItem>
                <cms:AdminTabItem ID="tiDescription" runat="server" value="description" EnabledImage="Admin/Img/icons/page_white_edit.png"><cms:LocalizedLiteral ID="llDescriptionTab" runat="server" /></cms:AdminTabItem>
            </cms:AdminTabStrip>
            <input type="hidden" id="hidIsDirty" runat="server" />
            <input type="hidden" id="hidSave" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="body" runat="server">
    <asp:Literal ID="litIcon" runat="server" Visible="false" Text="Admin/Img/Icons/page_white_edit.png" />
    <asp:Panel ID="pnlProperties" runat="server" CssClass="pnlTab">
        <asp:UpdatePanel ID="upnlProperties" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
            <ContentTemplate>
                <table class="editForm">
                    <tr>
                        <td style="width: 250px;"><cms:LocalizedLiteral ID="llName" runat="server" />:</td>
                        <td><asp:TextBox ID="txtFilename" runat="server" Width="500" /></td>
                    </tr>
                    <tr>
                        <td><cms:LocalizedLiteral ID="llFolder" runat="server" />:</td>
                        <td><ilib:iDropDownList ID="ddlFolders" runat="server" OnSelectedIndexChanged="ddlFolders_IndexChanged" AutoPostBack="true" /></td>
                    </tr>
                </table>
                <div class="adminPageSectionDivider"></div>
                <div style="font-size:16px; margin-top: 20px; padding-left: 2px;"><cms:LocalizedLiteral id="llAdvancedSettingsHeader" runat="server" /></div>
                <span class="editFormSubheader"><cms:LocalizedLiteral ID="llCategoriesHeader" runat="server" /></span>
                <table class="editForm">
                    <tr id="trCategories" runat="server" valign="top">
                        <td style="width: 250px;"><cms:LocalizedLiteral ID="llCategories" runat="server" />:</td>
                        <td id="tdCategories" style="padding-bottom: 8px;"><cms:CategorySelector id="csCategories" runat="server" ShowTabOverlay="true" /></td>
                    </tr>
                    <tr>
                        <td><cms:LocalizedLiteral ID="llSortKey" runat="server" />:</td>
                        <td><asp:TextBox ID="txtSortKey" runat="server" MaxLength="255" Width="400" /></td>
                    </tr>
                </table>
                <span class="editFormSubheader"><cms:LocalizedLiteral ID="llUserAccessControlHeader" runat="server" /></span>
                <table class="editForm">
                    <tr id="trRequiredUserGroups" runat="server" valign="top">
                        <td style="width: 250px;"><cms:LocalizedLiteral ID="llRequiredUserGroups" runat="server" />:</td>
                        <td id="tdRequiredUserGroups"><cms:UserGroupSelector id="gsRequiredUserGroups" runat="server" ShowTabOverlay="true" /></td>
                    </tr>
                </table>
                <span class="editFormSubheader"><cms:LocalizedLiteral ID="llAdministratorAccessControlHeader" runat="server" /></span>
                <table class="editForm">
                    <tr id="trAllowedAdministratorGroups" runat="server" valign="top">
                        <td style="width: 250px;"><cms:LocalizedLiteral ID="llAllowedAdministratorGroups" runat="server" />:</td>
                        <td id="tdAllowedAdminGroups"><cms:AdministratorGroupSelector id="gsAllowedAdministratorGroups" runat="server" ShowTabOverlay="true" /></td>
                    </tr>
                    <tr id="trDeniedAdministratorGroups" runat="server" valign="top">
                        <td><cms:LocalizedLiteral ID="llDeniedAdministratorGroups" runat="server" />:</td>
                        <td id="tdDeniedAdminGroups"><cms:AdministratorGroupSelector id="gsDeniedAdministratorGroups" runat="server" ShowTabOverlay="true" /></td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
        <div class="pnlTabOverlay"></div>
    </asp:Panel>
    <asp:Panel ID="pnlDescription" runat="server" CssClass="pnlTab">
        <asp:UpdatePanel ID="upnlDescription" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
            <ContentTemplate>
                <table class="editForm">
                    <tr>
                        <td><cms:LocalizedLiteral ID="llLocale" runat="server" />:</td>
                        <td><asp:DropDownList ID="ddlLocales" runat="server" OnSelectedIndexChanged="ddlLocales_IndexChanged" AutoPostBack="true" /></td>
                    </tr>
                </table>
                <div class="adminPageSectionDivider"></div>
                <table class="editForm">
                    <tr>
                        <td><cms:LocalizedLiteral ID="llTitle" runat="server" />:</td>
                        <td><asp:TextBox ID="txtTitle" runat="server" MaxLength="255" Width="600" /></td>
                    </tr>
                    <tr>
                        <td><cms:LocalizedLiteral ID="llDescription" runat="server" />:</td>
                        <td><asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Width="600" Rows="5" /></td>
                    </tr>
                </table>
            </ContentTemplate>
        </asp:UpdatePanel>
        <div class="pnlTabOverlay"></div>
    </asp:Panel>

    <script language="javascript" type="text/javascript">
        //<![CDATA[
        iLib.Dom.AddListener(window, "load", init);
        cms.Ajax.Init();
        cms.Ajax.AddEndRequestHandler(cms.Edit.HideTabOverlays);
        //]]>
    </script>
</asp:Content>
